package com.diamond.smart.data.config;

import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@EnableTransactionManagement //允许开启事务
@MapperScan({"com.diamond.gulimail.product.dao"})
@Configuration
public class MybatisConfig {

    @Bean
    public PaginationInterceptor paginationInterceptor() {
        PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
        //当前页是最后一页时点击下一页是否跳转至第一页或请求空数据：true-跳转到第一页，false-请求空数据
        paginationInterceptor.setOverflow(true);
        //设置每一页最大记录数
        paginationInterceptor.setLimit(1000);
        return paginationInterceptor;
    }

}
